 Packages <%= render 'admin/nav' %>
<% title 'Admin Graphs - Libraries.io' %>
<%= javascript_include_tag 'admin', 'data-turbolinks-track' => true %>

<div class="row">
  <div class="col-md-2">
    <h1>Graphs</h1>
  </div>
  <div class="col-md-10">
    <%= form_tag admin_graphs_path, method: :get, enforce_utf8: false do |f| %>
    <h4>
      <%= select_tag 'platform', options_for_select(Project.popular_platforms.map{|t| t['key'] }, @platform), onchange: "this.form.submit()" %>
    </h4>
    <% end %>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <p>
      <strong><%= @platform %> Packages by created_at</strong>
    </p>
    <%= line_chart @projects %>
    <% if @versions.any? %>
      <p>
        <strong><%= @platform %> Versions by created_at</strong>
      </p>
      <%= line_chart @versions %>
    <% end %>
  </div>
</div>
